jz();




function jz(){
    layui.use(['form','jquery','layer'],function (){
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.$;

        //点击提交修改信息
        form.on('submit(*)',function (d){
            console.log(d.field);
            var data = d.field;
            if (data.sealId == ''){
                data.sealId = 0;
                console.log(data);
                //代表次用户并没有被封停
                $.ajax({
                    url:'/YltUser/UserManage/addUserSeal',
                    type:'post',
                    data:data,
                    dataType:'json',
                    success:function (res){
                        if (res.state == '200'){
                            layer.msg('封停账户完毕',{time:1000,icon:6},function (){
                                let index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);

                            })
                        }else {
                            layer.msg("封停账户失败",{time: 1500,icon:5},function (){
                                let index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            });
                        }
                    },
                    errors:function (e){
                        console.log(e);
                        console.log("请求失败")
                    }
                })
            }else {
                //代表次用户已被封停，增加封停天数
                $.ajax({
                    url:'/YltUser/UserManage/upUserSealDate',
                    type:'post',
                    data:data,
                    dataType:'json',
                    success:function (res){
                        if (res.state == '200'){
                            layer.msg('封停账户完毕',{time:1000,icon:6},function (){
                                let index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            })
                        }else {
                            layer.msg("封停账户失败",{time: 1500,icon:5},function (){
                                let index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            });
                        }
                    },
                    errors:function (e){
                        console.log(e);
                        console.log("请求失败")
                    }
                })
            }
            return false;
        })
    })
}
//点击取消关闭
function qx(){
    //获取父级弹窗
    let index = parent.layer.getFrameIndex(window.name);
    //再执行关闭
    parent.layer.close(index);
}
